package com.zyy.dao;

import com.zyy.io.Resources;
import com.zyy.pojo.User;
import com.zyy.sqlSession.SqlSession;
import com.zyy.sqlSession.SqlSessionFactory;
import com.zyy.sqlSession.SqlSessionFactoryBuilder;

import java.io.InputStream;
import java.util.List;

/**
 * @author zyy
 * @date 2020/11/10 11:49 上午
 * @description
 */
//public class UserDaoImpl implements IUserDao {
//    public List<User> findAll() throws Exception {
//        InputStream resourceAsStream = Resources.getResourceAsStream("sqlMapConfig.xml");
//        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(resourceAsStream);
//        SqlSession sqlSession = sqlSessionFactory.openSession();
//
//        List<User> users = sqlSession.selectList("user.selectList");
//        return users;
//    }
//
//    public User findByCondition(User user) throws Exception {
//        InputStream resourceAsStream = Resources.getResourceAsStream("sqlMapConfig.xml");
//        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(resourceAsStream);
//        SqlSession sqlSession = sqlSessionFactory.openSession();
//
//        User user1 = sqlSession.selectOne("user.selectOne", user);
//        return user1;
//    }
//}
